#include <skyroad/service/service_constants.hpp>
#include <skyroad/service/response_router.hpp>
#include <skyroad/bus/bus.hpp>

response_router::response_router(bus& bus):router(bus)
{

}

void response_router::route(message& msg) 
{
    if (msg.destination().size() < 3)
    {
        return;
    }

    if (msg.destination()[0] != st_transport)
    {
        return;
    }

    int transport_id = msg.destination()[1];
    service* transport = host().find_service(transport_id);
    if (transport != NULL)
    {
        transport->handle_message(msg);
    }
} // namespace firebird